﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfControlDemo.资源介绍
{
    /// <summary>
    /// ResourcesWindow1.xaml 的交互逻辑
    /// </summary>
    public partial class ResourcesWindow1 : Window
    {
        public ResourcesWindow1()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            // 静态加载的资源 无法改变
            // 获取或修改当前窗口资源
            this.Resources["fontColor"] = new SolidColorBrush(Colors.Red);
        }

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            // 静态加载的资源 无法改变
            // 获取或修改当前窗口资源
            this.Resources["fontColor"]= new SolidColorBrush(Colors.Red);
            // 后台给前台控件赋值
            //button1.Foreground = new SolidColorBrush(Colors.Red);
        }

        private void Button_Click2(object sender, RoutedEventArgs e)
        {
            // 修改应用程序的字体资源
            Application.Current.Resources["ffamily"] = new FontFamily("楷体");
        }
    }
}
